unit JATUIF_Component_Border;

{$mode objfpc}{$H+}

interface

uses
  Classes, SysUtils, JATUIF_Component, JATUIF_Driver_Screen;

Type

    { TBorder }

    TBorder = class(TComponent)
      Protected
        Procedure _OnMouseEnter; override;
        Procedure _OnMouseLeave; override;
        Procedure _OnClick; override;
        Procedure Draw; override;
      Private
        bX1,bY1,bX2,bY2:Integer;
        Background_Color:Byte;
        Foreground_Color:Byte;
      Public
        Constructor Create(Parent:TScreen; X1,Y1,X2,Y2:Integer; ForegroundColor: Byte; BackgroundColor: Byte);
    end;

implementation

{ TBorder }

procedure TBorder._OnMouseEnter;
begin
     inherited _OnMouseEnter;
end;

procedure TBorder._OnMouseLeave;
begin
     inherited _OnMouseLeave;
end;

procedure TBorder._OnClick;
begin
     inherited _OnClick;
end;

procedure TBorder.Draw;
Var
   i:integer;

begin
     Screen.DrawCharXY(GetTag,bX1,bY1,#201,Foreground_Color,Background_Color);
     Screen.DrawCharXY(GetTag,bX1,bY2,#200,Foreground_Color,Background_Color);
     For i:=bX1+1 to bX2-1 do begin
         Screen.DrawCharXY(GetTag,i,bY1,#205,Foreground_Color,Background_Color);
         Screen.DrawCharXY(GetTag,i,bY2,#205,Foreground_Color,Background_Color);
     end;
     For i:=bY1+1 to bY2-1 do begin
         Screen.DrawCharXY(GetTag,bX1,i,#186,Foreground_Color,Background_Color);
         Screen.DrawCharXY(GetTag,bX2,i,#186,Foreground_Color,Background_Color);
     end;
     Screen.DrawCharXY(GetTag,bX2,bY1,#187,Foreground_Color,Background_Color);
     Screen.DrawCharXY(GetTag,bX2,bY2,#188,Foreground_Color,Background_Color);
end;

constructor TBorder.Create(Parent: TScreen; X1,Y1,X2,Y2:Integer; ForegroundColor: Byte; BackgroundColor: Byte);
begin
     bX1:= X1;
     bY1:= Y1;
     bX2:= X2;
     bY2:= Y2;
     Background_Color:= BackgroundColor;
     Foreground_Color:= ForegroundColor;
     inherited Create(Parent,bX1,bY1,bX2,bY2);
end;

end.

